<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="action_plan_work" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 任务流程 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="流程标题" prop="work_description">
              <el-input v-model="action_plan_work.work_description" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="重要等级" prop="work_level">
              <el-select style='width:100%' v-model="action_plan_work.work_level">
                <el-option label="普通" value="3" />
                <el-option label="重要" value="2" />
                <el-option label="紧急" value="1" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注" prop="remark">
              <el-input type="textarea" v-model="action_plan_work.remark" ttparea=350></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="taskReleaseSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>发布</el-button>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'TaskRelease',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        action_plan_work: {
          work_description: null,
          work_level: null,
          remark: null,
        },
        loading: false,
        rules: {
          work_description: [{
            required: true,
            message: "流程标题不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {},
    updated() {},
    mounted() {},
    methods: {
      taskReleaseSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/crm/sale/FactoryInv/taskReleaseSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/crm/sale/FactoryInv/factoryInv?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      n_update_work(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/FactoryInv/n_update_work?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
    },
  }
</script>
